import '../public/index'
import url from '../data/url'
import request from '../data/request'
import { header } from '../data/config'
import {getUrlParam} from '../data/util'

const base                   = url.base,
      getReportDetailDetail  = request.getReportDetailDetail

let id = getUrlParam('id');

let data = new Vue({
  el: '#data',
  data: () => ({
    enterpriseName  : '',
    bankNum         : '',
    name            : '',
    phone           : '',
    processStatus   : '',
    propertyName    : '',
    tradeAmount     : '',
    timeList        : '',

  }),
  mounted: function() {

    this.initPge();

  },
  methods: {
    initPge: function () { // 重置密码

      $.ajax({
        headers: header,
        url: base + getReportDetailDetail,
        data: { id: id}
      })
        .done(function (res) {
          console.log("初始化数据 success")
          console.log(res)

          data.bankNum        = res.object.identityCardImage.bankNum;
          data.name           = res.object.identityCardImage.name;
          data.phone          = res.object.identityCardImage.phone;
          data.propertyName   = res.object.identityCardImage.propertyName;
          data.processStatus  = res.object.identityCardImage.processStatus;
          data.tradeAmount    = res.object.identityCardImage.tradeAmount;
          data.timeList       = res.object.logList;

          switch ( data.$data.processStatus ){
            case '0':
              data.$data.processStatus = '创建订单'
              break;
            case '1':
              data.$data.processStatus = '开户成功'
              break;
            case '2':
              data.$data.processStatus = '开户失败'
              break;
            case '3':
              data.$data.processStatus = '入金成功'
              break;
            case '4':
              data.$data.processStatus = '入金失败'
              break;
            case '5':
              data.$data.processStatus = '冻结成功'
              break;
            case '6':
              data.$data.processStatus = '冻结失败'
              break;
            case '7':
              data.$data.processStatus = '解冻成功'
              break;
            case '8':
              data.$data.processStatus = '解冻失败'
              break;
            case '9':
              data.$data.processStatus = '转出失败'
              break;
            case '10':
              data.$data.processStatus = '转出成功'
              break;
            default: this.$data.processStatus = '未知';
          }

          console.log(data.$data)
        })
        .fail(function (res) {
          console.log(res)

          layer.msg('初始化数据失败', {
            icon: 5
          })

          console.log("error")
        })
        .always(function (res) {

          console.log("complete")
        })

    }
  }
})

